<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Ver compra</title>
	<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
	<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
	<style>
		.badge {
			float: right;
		}
	</style>

      </head>
<body>
  		
        @if (!empty($compra))
  			
  			 <div class="container">
    <div class="row">
        <div class="well col-xs-6 col-sm-6 col-md-6">
            <div class="row">
                <div class="col-xs-6 col-sm-6 col-md-6">
                    <address>
                        <strong>Sistema de ganadería</strong>
                        <br>
                        UTP, David
                        <br>
                        Panamá
                        <br>
                        <abbr title="Phone">P:</abbr> (213) 484-6829
                    </address>
                </div>
                <div class="col-xs-6 col-sm-6 col-md-6 text-right">
                    {{-- */$proveedor = ClienteProveedor::where('id',$compra->id_proveedor)->first()/* --}}
                    <p>
                        <em>Fecha: {{$compra->fecha}}</em>
                    </p>
                    <p><em>Compra #: <b class="text-danger">{{$compra->num_factura}}</b></em></p>
                    
                    <p><em>Proveedor ID: <b>{{$proveedor->nombre}}</b></em></p>
                    <p><em>Vendedor : <b>{{$compra->nombre_vendedor}}</b></em></p>
                </div>
            </div>
            <div class="row">
                <div class="text-center">
                    <h1><b>Compra</b></h1>
                </div>
                </span>
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>ID</th>
                        <th>ID Compra</th>
                        <th>ID Ganado</th>
                        <th>Precio x kilo</th>
                        <th>Peso (kg) </th>
                        <th>Monto ($) </th>
                        </tr>
                    </thead>
                    <tbody>
                @foreach(DetalleCompra::where('id_compras',$compra->id)->get() as $detalle)
                      <tr>
                        <td>{{$detalle->id}}</td>
                        <td>{{$detalle->id_compras}}</td>
                        <td>{{$detalle->id_ganado}}</td>
                        <td>{{$detalle->precio_kilo}}</td>
                        <td>{{$detalle->peso}}</td>
                        <td>{{$detalle->precio_bruto}}</td>
                    </tr>
                @endforeach
                        <tr>
                            <td>   </td>
                            <td>   </td>
                            <td>   </td>
                            <td>   </td>
                            <td class="text-right">
                            <p>
                                <strong>Subtotal: </strong>
                            </p>
                            <p>
                                <strong>Descuento: </strong>
                            </p>
                            <p><strong>ITBMS: </strong> </p>
                            </td>
                            <td class="text-center">
                            <p><strong> ${{$compra->total_bruto}} </strong></p>
                            <p><strong><strong>${{number_format(($compra->descuento/100)*($compra->total_bruto),2)}} </strong></p>
                            <p><strong>${{number_format(($compra->itbms/100)*(($compra->total_bruto)-($compra->descuento/100)*($compra->total_bruto)),2)}} </strong></p>
                        </td>
                        </tr>
                        <tr>
                            <td>   </td>
                            <td>   </td>
                            <td>   </td>
                            <td>   </td>
                            <td class="text-right"><h4><strong>Total: </strong></h4></td>
                            <td class="text-center text-danger"><h4><strong>${{$compra->total}}</strong></h4></td>
                        </tr>
                    </tbody>
                </table>
                  <div class="modal-footer">
                <a href="/compras" class="btn btn-success btn-lg btn-block" data-dismiss="modal">
                    Regresar   <span class="glyphicon glyphicon-chevron-right"></span></a>
                </td>               
                  </div>       
        
        @else
        <p>
          No existe información para ésta compra.
        </p>
        @endif

		</div>
    

</body>
</html>